#判断主机是否存活
#!/bin/bash
ping -c 3 -i 0.2 -W 1 $1 &>/dev/null
if [ $? -eq 0 ]; then
   echo "host $1 is up"
else
   echo "host $1 is down"
fi
